package entity

import (
	"manager/model/po"

	"github.com/lib/pq"
)

type Repair struct {
	Id int64 `gorm:"column:id;type:BIGINT;primary_key" json:"id"`

	Reportman int64 `gorm:"column:reportman;type:BIGINT" json:"reportman"`

	EbikeId int64 `gorm:"column:ebike_id;type:BIGINT" json:"ebike_id"`

	FaultId int64 `gorm:"column:fault_id;type:BIGINT" json:"fault_id"`

	FaultTypeId int64 `gorm:"column:fault_type_id;type:BIGINT" json:"fault_type_id"`

	Other string `gorm:"column:other;type:VARCHAR(255)" json:"other"`

	Type int `gorm:"column:type;type:TINYINT" json:"type"`

	Coordinate po.Point `gorm:"column:coordinate;type:POINT" json:"coordinate"`

	Photo pq.StringArray `gorm:"column:photo;type:VARCHAR[]" json:"photo"`

	OrderNo string `gorm:"column:order_no;type:VARCHAR(255)" json:"order_no"`

	Status int `gorm:"column:status;type:TINYINT" json:"status"`

	Repairman int64 `gorm:"column:repairman;type:BIGINT" json:"repairman"`

	Price int64 `gorm:"column:price;type:BIGINT" json:"price"`

	StoreId int64 `gorm:"column:store_id;type:BIGINT" json:"store_id"`

	Desc string `gorm:"column:desc;type:VARCHAR(255)" json:"desc"`

	RepairAt int64 `gorm:"column:repair_at;type:BIGINT" json:"repair_at"`

	FaultName     string `json:"fault_name"`
	FaultTypeName string `json:"fault_type_name"`

	EbikeTypeId    int64  `json:"ebike_type_id"`
	EbikeTypeName  string `json:"ebike_type_name"`
	EbikeTypeImage string `json:"ebike_type_image"`

	CreatedAt int64 `gorm:"column:created_at;type:BIGINT" json:"created_at"`

	UpdatedAt int64 `gorm:"column:updated_at;type:BIGINT" json:"updated_at"`

	AcceptedAt int64 `gorm:"column:accepted_at;type:BIGINT" json:"accepted_at"`
}

func (a *Repair) TableName() string {
	return "repairs"
}
